package com.it.schoolbookshop_back.utils;

/**
 * 常量类，定义系统中使用的状态码
 */
public class Code {
    // 成功状态码
    public static final Integer SUCCESS = 200;
    
    // 客户端错误状态码 (4xx)
    public static final Integer BAD_REQUEST = 400;
    public static final Integer UNAUTHORIZED = 401;
    public static final Integer FORBIDDEN = 403;
    public static final Integer NOT_FOUND = 404;
    public static final Integer METHOD_NOT_ALLOWED = 405;
    
    // 服务器错误状态码 (5xx)
    public static final Integer INTERNAL_SERVER_ERROR = 500;
    public static final Integer SERVICE_UNAVAILABLE = 503;
    
    // 自定义业务状态码
    public static final Integer PARAMETER_ERROR = 1001; // 参数校验错误
    public static final Integer USER_NOT_EXIST = 1002;  // 用户不存在
    public static final Integer LOGIN_ERROR = 1003;     // 登录错误（密码错误）
    public static final Integer REGISTER_ERROR = 1004;  // 注册错误（用户已存在）
    public static final Integer TOKEN_ERROR = 1005;     // Token无效或过期
    
    // 书籍相关状态码
    public static final Integer BOOK_NOT_EXIST = 2001;  // 书籍不存在
    public static final Integer BOOK_ALREADY_SOLD = 2002; // 书籍已售出
    public static final Integer FAVORITE_ERROR = 2003;  // 收藏操作错误
    
    // 其他自定义状态码
    public static final Integer UPLOAD_ERROR = 3001;    // 文件上传错误
    public static final Integer DATABASE_ERROR = 3002;  // 数据库操作错误
    
    // CRUD操作相关状态码
    public static final Integer SAVE_OK = 20011;        // 保存成功
    public static final Integer DELETE_OK = 20021;      // 删除成功
    public static final Integer UPDATE_OK = 20031;      // 更新成功
    public static final Integer GET_OK = 20041;         // 查询成功
    
    public static final Integer SAVE_ERR = 20010;       // 保存失败
    public static final Integer DELETE_ERR = 20020;     // 删除失败
    public static final Integer UPDATE_ERR = 20030;     // 更新失败
    public static final Integer GET_ERR = 20040;        // 查询失败
} 